APP = server

SRCS = $(wildcard ./*.c)
DEPS = $(SRCS:.c=.d)
OBJS = $(SRCS:.c=.o)

CC = gcc
CFLAGS = -Wall
LDFLAGS =
LDLIBS = -lpthread
RM = rm -rf


.SUFFIXES: .d
.c.d:
	$(CC) -MM $(CFLAGS) $< > $@

.PHONY: all
.PHONY: clean
.PHONY: distclean

all: $(APP)

-include $(DEPS)
dep: $(DEPS)

$(APP): $(OBJS)
	$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDLIBS) -o $@

clean :
	$(RM) *.o *.d *~

distclean:
	$(RM) $(APP) *.o *.d *~
